BEGIN TRANSACTION;
BEGIN TRY
    INSERT INTO Orders (ProductID, Quantity) VALUES (101, 5);
    UPDATE Inventory SET Stock = Stock - 5 WHERE ProductID = 101;
    COMMIT TRANSACTION;
END TRY
BEGIN CATCH
    ROLLBACK TRANSACTION;
    PRINT '库存不足，订单取消';
END CATCH;
